import Vue from 'vue'
import router from './router'
//element-ui 插件
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import App from './App'

import './assets/Global.css'
//树形表单插件
import ZkTable from 'vue-table-with-tree-grid'
//富文本插件
import VueQuillEditor from 'vue-quill-editor'
// 富文本插件样式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
//进度条
import nprogress from 'nprogress'
import 'nprogress/nprogress.css'

//http 请求插件
import axios from 'axios'
/*
Vue.config.productionTip = false
*/

axios.defaults.baseURL="http://127.0.0.1:8090/v1/"
//设置请求拦截器
axios.interceptors.request.use(config =>{
  //显示进度条
  nprogress.start();
  const token = window.sessionStorage.getItem("token");
  //单独设置请求头信息
  if (token && config.url.endsWith('/804909574412544580')) {
    return config;
  }
  config.headers.Authorization = token;
  return config;
});

axios.interceptors.response.use(config =>{
  //响应成功后隐藏进度条
  nprogress.done();
  return config;
})

Vue.prototype.$axios = axios

Vue.use(router);
Vue.use(ElementUI);
Vue.use(ZkTable);
Vue.use(VueQuillEditor);
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router, //启动路由
  render: h => h(App) //启动elementuI
})
